package com.zqxq.common.bizEnums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Filename FileTypeEnum.java
 * 
 * @Description
 * 
 * @Version 1.0
 * 
 * @Author dyp
 * 
 * @Email weizhi@yiji.com
 * 
 * @History <li>Author: dyp</li> <li>Date: 2015-3-26</li> <li>Version: 1.0
 * </li> <li>Content: create</li>
 * 
 */
public enum FileTypeEnum {

	/** 基础资源图片 */
	MAINLINE_COURSE_IMAGE("MAINLINE_COURSE_IMAGE","mainline_course/image/", "基础资源图片"),

	/** 基础资源音频 */
	MAINLINE_COURSE_AUDIO("MAINLINE_COURSE_AUDIO","mainline_course/audio/", "基础资源音频"),

	;
	
	private final String code;
	private final String message;
	private final String msg;

	private FileTypeEnum(String code, String message, String msg) {
		this.code = code;
		this.message = message;
		this.msg = msg;
	}
	
	public String getCode() {
		return code;
	}
	
	public String getMessage() {
		return message;
	}

	public String getMsg() {
		return msg;
	}

	/**
	 * @return Returns the code.
	 */
	public String code() {
		return code;
	}
	
	/**
	 * @return Returns the message.
	 */
	public String message() {
		return message;
	}


	public String msg() {
		return msg;
	}

	/**
	 * 通过枚举<code>code</code>获得枚举
	 * 
	 * @param code
	 * @return LogResultEnum
	 */
	public static FileTypeEnum getByCode(String code) {
		for (FileTypeEnum _enum : values()) {
			if (_enum.getCode().equalsIgnoreCase(code)) {
				return _enum;
			}
		}
		return null;
	}
	
	/**
	 * 获取全部枚举
	 * 
	 * @return List<LogResultEnum>
	 */
	public List<FileTypeEnum> getAllEnum() {
		List<FileTypeEnum> list = new ArrayList<FileTypeEnum>();
		for (FileTypeEnum _enum : values()) {
			list.add(_enum);
		}
		return list;
	}
	
	/**
	 * 获取全部枚举值
	 * 
	 * @return List<String>
	 */
	public List<String> getAllEnumCode() {
		List<String> list = new ArrayList<String>();
		for (FileTypeEnum _enum : values()) {
			list.add(_enum.code());
		}
		return list;
	}

    public List<Map<String, Object>> getListMap(){
        List<Map<String, Object>> arrayList = new ArrayList();
        for (FileTypeEnum _enum : values()) {
            Map<String, Object> infoMap = new HashMap();
            infoMap.put("value",_enum.getCode());
            infoMap.put("label", _enum.getMsg());
            arrayList.add(infoMap);
        }
        return arrayList;
    }
}
